﻿using System;
using System.ComponentModel;
using System.Windows.Forms;
using System.Windows.Forms.Design;

namespace WenSkin.Controls
{
    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.All), DefaultEvent("ValueChanged")]
    [ToolboxItem("System.Windows.Forms.Design.AutoSizeToolboxItem")]
    public class ToolStripCheckBox : ToolStripControlHost
    {
        public ToolStripCheckBox() : base(new CheckBox())
        {
            CheckBox.CheckedChanged += CheckBox_CheckedChanged;
        }

        public event EventHandler CheckedChanged;
        private void CheckBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckedChanged?.Invoke(sender, e);
        }

        [Category("Wen"), Description("是否选中")]
        public bool Checked { get => CheckBox.Checked; set => CheckBox.Checked = value; }
        [Category("Wen"), Description("CheckBox")]
        public CheckBox CheckBox
        {
            get { return (CheckBox)Control; }
        }
    }
}
